package br.com.jw.controle.menu;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import br.com.jw.controle.login.R;
import br.com.jw.dao.MenuDao;
import br.com.jw.modelo.Menu;
import br.com.jw.util.MenuOpcoes;

public class CadastrarAlterarMenu extends MenuOpcoes{
	Intent intent;
	EditText etNomeMenu;
	Button btSalvarMenu,btAlterarMenu;
	MenuDao menuDao;
	Menu menu;
	 @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.cadastrar_alterar_menus);
	        
	        inicializarComponentes();
	        menuDao = new MenuDao(getApplicationContext());
	        menu = new Menu();
	        
	        intent = getIntent();
	        if(intent != null){	        	
	        	menu = (Menu) intent.getSerializableExtra("menu"); 
	        }else{	        	
	        }
	        if(menu != null){
	        	btSalvarMenu.setVisibility(View.GONE);
	        	etNomeMenu.setText(menu.getMen_nome());
	        }else{
	        	btAlterarMenu.setVisibility(View.GONE);
	        	etNomeMenu.setText("");
	        }
	 }
	 public void inicializarComponentes(){
	 etNomeMenu = (EditText) findViewById(R.id.etNomeMenu);
	 btSalvarMenu=(Button) findViewById(R.id.btSalvarMenu);
	 btAlterarMenu=(Button) findViewById(R.id.btAlterarMenu);
}
}